<template>
  <div>
    <!-- 用户管理页主体部分 -->
    <el-card>
      <div slot="header">
        <span>评论管理</span>
      </div>
      <div>
        <div>
          <el-table :data="commentList" border stripe>
            <el-table-column type="index" label="#">
            </el-table-column>
            <el-table-column prop="author.nickName" label="评论者">
            </el-table-column>
            <el-table-column prop="content" label="评论内容">
              <template slot-scope="scope">
                <el-popover trigger="hover" placement="top">
                  <p>所在文章: {{ scope.row.post.title }}</p>
                  <div slot="reference" class="name-wrapper">
                    <el-tag size="medium">{{ scope.row.content }}</el-tag>
                  </div>
                </el-popover>
              </template>
            </el-table-column>
            <el-table-column label="评论时间" width="180">
              <template slot-scope="scope">
                <div>{{scope.row.createAt|dateFormat}}</div>
              </template>
            </el-table-column>
            <el-table-column label="是/否通过" width="180">
              <template slot-scope="scope">
                <el-switch v-model="scope.row.state" active-color="#13ce66" inactive-color="#ff4949">
                </el-switch>
              </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" width="180">
              <template slot-scope="scope">
                <el-button type="danger" size="small" @click="deleteuser(scope.row._id)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="paging_box" id="searchkey">
          <el-pagination background @current-change="handleCurrentChange" :current-page="commentList.page" :page-size="10" layout="total, prev, pager, next" :total="commentList.total">
          </el-pagination>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      commentList: []
    }
  },
  created() {
    this.getcommentinfo()
  },
  methods: {
    async getcommentinfo() {
      // const res = await this.$http.get('/comments')
      // console.log(res)
    },
    // 当前在第几页
    handleCurrentChange(nwepage) { }
  }
}
</script>

<style scoped>

</style>
